package my.ssma.controller.impl;

import com.alibaba.fastjson.JSON;
import my.ssma.controller.UserController;
import my.ssma.domain.User;
import my.ssma.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/userController")
public class UserControllerImpl implements UserController {


    @GetMapping("/user")
    public String userTest(){
        return "ha";
    }

    @Autowired
    private UserService userService;


    @GetMapping("/my")
    public String myFindAll(){

        List<User> users = userService.myFindAll();

        return JSON.toJSONString(users);
    }

}
